<?php
/* @var $this TeamController */
/* @var $model Team */

$this->breadcrumbs=array(
	'Management'=>array('/site/management/'),
	'Maintenance'=>array('/site/maintenance/'),
	'Team Management',
);

if(Yii::app()->user->can_create_edit_roles){

	$this->menu=array(
		array('label'=>'Create a Team', 'url'=>array('create')),
	);
} else {
	$this->menu=array(
		array('label'=>'Update My Team', 'url'=>array('update', 'id'=>Yii::app()->user->team_id)),
	);
}


Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#team-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Team Management</h1>


<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'team-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		//'idteam',
		'short_name',
		'full_name',
		'description',
		'email_distribution',
		array(
			'name'=>'enabled',
			'header'=>'Enabled',
			'value'=> 'User::getYesNoValue($data->enabled)',
			'filter' => array('0'=>'No', '1'=>'Yes'),
			'htmlOptions' => array(
								'style' => 'width:20px;text-align:center;',
							 ),
		),
		/*
		'pad_url',
		*/
		array(
			'class'=>'CButtonColumn',
			'header'=>'Actions',
			'template'=>'{view}{update}',
			'buttons'=>array(
						'view'=>array(
									'url'=>'Yii::app()->createUrl("team/view", array("id"=>$data->idteam))',
									'label'=>'View',
									'options' => array('style'=>'width:10px;','title'=>'View Details')
						          ),
						'update'=>array(
									'url'=>'Yii::app()->createUrl("team/update", array("id"=>$data->idteam))',
									'label'=>'Update',
									'visible'=> '(($data->idteam == Yii::app()->user->team_id) or (Yii::app()->user->can_create_edit_roles))',
									'options' => array('style'=>'width:10px;','title'=>'Update')
						          ),
						
					   ),			
		),	
	),
)); ?>
